$(document).ready(function(){
  $("#loginBtn").click(function(){
		$.post("login", $("#loginForm").serialize(),function(data){
			//making it work with FF......
			var serializer = new XMLSerializer();
			var xml = serializer.serializeToString(data);
			data = xml.replace("<firefoxsucks>","").replace("</firefoxsucks>","");
			//real begining fo function
			if (data == "loggedin"){
				//alter top menu
				$("#unloggedMenu").css("display","none");
				$("#logout").css("display","inline");
				//reload menu
				$("#linksmenu").load('contents/side_menu.jsp');
				//do the same as when 'home' is clicked
				$("#home").click();
			}else{
				$("#loginErr").html("Wrong username or password");
			}
		});
  
  });
});